/** Component: Card */

@use '../../scss/_mixins.scss' as *;

:root {
  --strapi-card-border-color: var(--strapi-neutral-150);
  --strapi-card-border-color-dark: var(--strapi-neutral-150);
  --strapi-card-border-color-light: var(--strapi-neutral-150);
  --strapi-card-border-radius: 4px;
  --strapi-card-background-dark: linear-gradient(180deg, var(--strapi-neutral-100) 0%, var(--strapi-neutral-0) 100%);
  --strapi-card-background-light: var(--strapi-neutral-0);
  --strapi-card-box-shadow: 0 0 0 transparent;
  --strapi-card-content-delimited: 395px;
  --strapi-card-img-border-width: 1px;
  --strapi-card-img-border-radius: 4px;
  --strapi-card-img-bg-scale: 1;
  --strapi-card-justify-content: center;
  --strapi-card-position: relative;
  --strapi-card-overflow: hidden;
  --strapi-card-text-align: center;
  --strapi-card-gap: var(--strapi-spacing-2);
  --strapi-card-px: var(--strapi-spacing-10);
  --strapi-card-py: var(--strapi-spacing-10);
  --strapi-card-title-arrow-left: var(--strapi-card-gap);
  --strapi-card-title-color: var(--strapi-neutral-800);
  --strapi-card-title-font-size: 17px;
  --strapi-card-title-font-weight: 700;
  --strapi-card-title-line-height: 26px;
  --strapi-card-description-color: #4E6294;
  --strapi-card-description-font-size: 15px;
  --strapi-card-description-line-height: 24px;
  --strapi-card-hover-border-color: #D6D6FF;
  --strapi-card-hover-img-bg-scale: 1.15;
  --strapi-card-container-icon-background-color-cms: var(--strapi-primary-100);
  --strapi-card-container-icon-background-color-cloud: var(--strapi-secondary-100);
}

/* Ces sélecteurs doivent être en dehors du bloc card pour fonctionner correctement */
:global(.category-cms) .card-category-icon-container {
  background-color: var(--strapi-card-container-icon-background-color-cms);
}

:global(.category-cloud) .card-category-icon-container {
  background-color: var(--strapi-card-container-icon-background-color-cloud);
}

.card {
  position: var(--strapi-card-position);
  overflow: var(--strapi-card-overflow);
  // background: var(--strapi-card-background);
  background-color: transparent;
  border-radius: var(--strapi-card-border-radius);
  border: 1px solid var(--strapi-card-border-color-light);
  // box-shadow: var(--strapi-card-box-shadow);
  display: flex;
  flex-direction: column;
  gap: var(--strapi-card-gap);
  align-items: stretch;
  justify-content: var(--strapi-card-justify-content);
  text-align: var(--strapi-card-text-align);
  padding: var(--strapi-card-py) var(--strapi-card-px);
  transition: all 0.2s ease;
  background: var(--strapi-card-background-light);

  &:focus, &:hover {
    --strapi-card-border-color: var(--strapi-card-hover-border-color);
    --strapi-card-title-arrow-left: var(--strapi-spacing-3);
    --strapi-card-img-bg-scale: var(--strapi-card-hover-img-bg-scale);
    cursor: pointer;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  }

  &-category-icon-container {
    display: flex;
    padding: 12px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 4px;
    background: var(--strapi-card-container-icon-background-color-cms);
  }

  &__title {
    display: block;
    color: var(--strapi-card-title-color);
    font-size: var(--strapi-card-title-font-size);
    font-weight: var(--strapi-card-title-font-weight);
    line-height: var(--strapi-card-title-line-height);
    margin: 0;
    font-family: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important; 
    font-size: 28px;
    font-style: normal;
    font-weight: 600;
    line-height: 36px;
    padding-top: 6px;

    &:after {
      content: none;
    }

    &__arrow {
      display: inline-block;
      line-height: 0;
      margin-left: var(--strapi-card-title-arrow-left);
      transition: margin-left 0.1s ease;
    }
  }

  &__description {
    --ifm-link-color: var(--strapi-card-description-color);
    --ifm-link-decoration: underline;

    color:#A5A5BA;
    font-family: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important; 
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 28px;
  }

  &__img {
    border: var(--strapi-card-img-border-width) solid var(--strapi-card-img-border-color, #fff);
    border-bottom: none;
    border-radius: var(--strapi-card-img-border-radius);
    margin-top: var(--strapi-card-gap);
    margin-left: auto;
    margin-right: auto;
    margin-bottom: calc(var(--strapi-card-py) * -1);
    box-shadow: 0 1px 10px 0 #7A78B61A;

    &-bg {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%) scale(var(--strapi-card-img-bg-scale));
      transition: transform 0.2s ease;
      width: auto;
      height: auto;
    }
  }

  &--cta {
    --strapi-card-text-align: left;
    --strapi-card-gap: var(--strapi-spacing-2);
    --strapi-card-title-font-size: 21px;
    --strapi-card-title-font-weight: 600;
    --strapi-card-title-line-height: 28px;
    --ifm-link-decoration: none;
    --ifm-link-hover-decoration: none;
    box-shadow: 0px 1px 4px 0px rgba(24, 24, 38, 0.10);
  }

  &--content-delimited {
    .card {
      &__title,
      &__description {
        width: 100%;
        max-width: var(--strapi-card-content-delimited);
        margin-right: auto;
        margin-left: auto;
      }
    }
  }
}

/** Note: Icons size (icons at top of cards) is defined in icons.scss */

/** Responsive */
@include medium-up {
  :root {
    --strapi-card-px: var(--strapi-spacing-10);
    --strapi-card-py: var(--strapi-spacing-10);
  }

  .card {
    &__title {
      &__arrow {
        transition: margin-left 0.2s ease;
        will-change: margin-left;
      }
    }

    &:focus, &:hover {
      &.card--cta {
        // --strapi-card-border-color: #D6D6FF;
        // --strapi-card-box-shadow: 0px 1px 4px rgba(33, 33, 52, 0.1);
      }
    }

    &--cta {
      transition: all 0.2s ease;
      will-change: border-color, box-shadow, color;

      .card {
        &__img {
          transition: all 0.2s ease;
          will-change: border-radius, transform;
          transform:
            scale(var(--strapi-card-img-scale, 1))
            translate(var(--strapi-card-img-translate, '0, 0'))
          ;
        }
      }
    }
  }
}

/** Dark mode */
@include dark {
  --strapi-card-border-color: var(--strapi-card-border-color-dark);
  --strapi-card-title-color: var(--strapi-neutral-1000);
  --strapi-card-description-color: var(--strapi-neutral-400);
  --strapi-card-img-border-color: rgba(255, 255, 255, 0.5);
  --strapi-card-hover-border-color: #49494D;
  
  /* Définir des versions dark mode des couleurs de catégories */
  --strapi-card-container-icon-background-color: var(--strapi-neutral-0);
  --strapi-card-container-icon-background-color-cms: var(--strapi-neutral-0);
  --strapi-card-container-icon-background-color-cloud: var(--strapi-neutral-0);

  .card {
    background: var(--strapi-card-background-dark);

    &-category-icon-container {
      /* Couleur par défaut pour tous les conteneurs d'icônes */
      background-color: var(--strapi-card-container-icon-background-color);
    }

    &--cta {
      border: solid 1px var(--strapi-card-border-color-dark);
      box-shadow: 0px 1px 10px 0px rgba(3, 3, 5, 0.35);

      &:focus, &:hover {
        --strapi-card-border-color: #49494D;
        --strapi-card-color: var(--strapi-neutral-1000);
        --ifm-link-hover-color: var(--strapi-neutral-1000);
      }
    }
  }

  [class*="card__img"] {
    border: none !important;
  }
}